﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace YellowMap
{
    public enum DirectionIcon
    {
        NONE,
        GO_STRAIGHT,
        U_TURN_LEFT,
        U_TURN_RIGHT,
        TURN_LEFT,
        TURN_RIGHT,
        KEEP_LEFT,
        KEEP_RIGHT,
        ROUNGABOUT_LEFT,
        ROUNDABOUT_RIGHT,
        SLIGHT_LEFT,
        SLIGHT_RIGHT,
        SHARP_LEFT,
        SHARP_RIGHT
    }
    
    public class Common
    {
        public static DirectionIcon RegconizeDirectionIcon_En(string destruction)
        {
            destruction = destruction.Replace("  ", " ");
            #region U_TURN_RIGHT
            if (destruction.Contains("Make a  U-turn  at") && destruction.Contains("on the right"))
            {
                return DirectionIcon.U_TURN_RIGHT;
            } 
            #endregion

            #region U_TURN_LEFT
            if (destruction.Contains("Make a  U-turn  at") && destruction.Contains("on the right"))
            {
                return DirectionIcon.U_TURN_LEFT;
            } 
            #endregion

            #region KEEP_LEFT
            if (destruction.Contains("Keep  left"))
            {
                return DirectionIcon.KEEP_LEFT;
            } 
            #endregion

            #region KEEP_RIGHT
            if (destruction.Contains("Keep  right"))
            {
                return DirectionIcon.KEEP_RIGHT;
            } 
            #endregion

            #region SLIGHT_RIGHT
            if (destruction.Contains("Slight  right"))
            {
                return DirectionIcon.SLIGHT_RIGHT;
            } 
            #endregion

            #region SLIGHT_LEFT
            if (destruction.Contains("Slight  left"))
            {
                return DirectionIcon.SLIGHT_LEFT;
            } 
            #endregion

            #region ROUNDABOUT_RIGHT
            if (destruction.Contains("At the roundabout") && destruction.Contains("on the right"))
            {
                return DirectionIcon.ROUNDABOUT_RIGHT;
            } 
            #endregion

            #region ROUNGABOUT_LEFT
            if (destruction.Contains("At the roundabout") && destruction.Contains("on the left"))
            {
                return DirectionIcon.ROUNGABOUT_LEFT;
            } 
            #endregion

            #region TURN_RIGHT
            if (destruction.Contains("Turn right"))
            {
                return DirectionIcon.TURN_RIGHT;
            } 
            #endregion

            #region TURN_LEFT
            if (destruction.Contains("Turn left"))
            {
                return DirectionIcon.TURN_LEFT;
            } 
            #endregion

            #region SHARP_RIGHT
            if (destruction.Contains("Sharp right"))
            {
                return DirectionIcon.SHARP_RIGHT;
            } 
            #endregion

            #region SHARP_LEFT
            if (destruction.Contains("Sharp left"))
            {
                return DirectionIcon.SHARP_LEFT;
            } 
            #endregion


            #region TURN_RIGHT 2
            if (destruction.Contains("Take the") && destruction.Contains("right onto"))
            {
                return DirectionIcon.TURN_RIGHT;
            }

           
            #endregion

            #region TURN_LEFT 2
            if (destruction.Contains("Take the") && destruction.Contains("left onto"))
            {
                return DirectionIcon.TURN_LEFT;
            }

           
            #endregion

            if (destruction.Contains("Take the") && destruction.Contains("right"))
            {
                return DirectionIcon.TURN_RIGHT;
            }

            if (destruction.Contains("Take the") && destruction.Contains("left"))
            {
                return DirectionIcon.TURN_LEFT;
            }

            return DirectionIcon.GO_STRAIGHT;
        }
        public static DirectionIcon RegconizeDirectionIcon_Vi(string destruction)
        {
            destruction = destruction.Replace("  ", " ");

            #region U_TURN_RIGHT
            if (destruction.Contains("Vòng ngược lại") && (destruction.Contains("ở phía bên phải") || destruction.Contains("ở phía phải")))
            {
                return DirectionIcon.U_TURN_RIGHT;
            }
            #endregion

            #region U_TURN_LEFT
            if (destruction.Contains("Vòng ngược lại") && (destruction.Contains("ở phía bên trái") || destruction.Contains("ở phía trái")))
            {
                return DirectionIcon.U_TURN_LEFT;
            }
            #endregion

            #region KEEP_LEFT
            if (destruction.Contains("Đi bên trái"))
            {
                return DirectionIcon.KEEP_LEFT;
            }
            #endregion

            #region KEEP_RIGHT
            if (destruction.Contains("Đi bên phải"))
            {
                return DirectionIcon.KEEP_RIGHT;
            }
            #endregion

            #region SLIGHT_RIGHT
            if (destruction.Contains("Chếch sang phải"))
            {
                return DirectionIcon.SLIGHT_RIGHT;
            }
            #endregion

            #region SLIGHT_LEFT
            if (destruction.Contains("Chếch sang trái"))
            {
                return DirectionIcon.SLIGHT_LEFT;
            }
            #endregion

            #region ROUNDABOUT_RIGHT
            if (destruction.Contains("Tại chỗ đường vòng") && (destruction.Contains("ở phía bên phải") || destruction.Contains("ở phía phải")))
            {
                return DirectionIcon.ROUNDABOUT_RIGHT;
            }
            #endregion

            #region ROUNGABOUT_LEFT
            if (destruction.Contains("Tại chỗ đường vòng") && (destruction.Contains("ở phía bên trái") || destruction.Contains("ở phía trái")))
            {
                return DirectionIcon.ROUNGABOUT_LEFT;
            }
            #endregion

            #region TURN_RIGHT
            if (destruction.Contains("Rẽ phải"))
            {
                return DirectionIcon.TURN_RIGHT;
            }
            #endregion

            #region TURN_LEFT
            if (destruction.Contains("Rẽ trái"))
            {
                return DirectionIcon.TURN_LEFT;
            }
            #endregion

            #region SHARP_RIGHT
            if (destruction.Contains("Ngoặt phải"))
            {
                return DirectionIcon.SHARP_RIGHT;
            }
            #endregion

            #region SHARP_LEFT
            if (destruction.Contains("Ngoặt trái"))
            {
                return DirectionIcon.SHARP_LEFT;
            }
            #endregion

            return DirectionIcon.GO_STRAIGHT;
        }

        

    }
}
